package com.zrkizzy.seckill.service.core;

import com.zrkizzy.seckill.dto.LoginDTO;
import com.zrkizzy.seckill.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zrkizzy.seckill.vo.common.Result;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *  用户业务接口
 * </p>
 *
 * @author zhangrongkang
 * @since 2023-03-20
 */
public interface IUserService extends IService<User> {

    /**
     * 执行登录操作
     *
     * @param loginDTO 登录数据传输对象
     * @param request request请求
     * @param response response响应
     * @return 公共返回对象
     */
    Result doLogin(LoginDTO loginDTO, HttpServletRequest request, HttpServletResponse response);

    /**
     * 从Cookie中获取User对象
     *
     * @param ticket 存储的ticket
     * @param request request请求
     * @param response response响应
     * @return 用户对象
     */
    User getUserByCookie(String ticket, HttpServletRequest request, HttpServletResponse response);
}
